/**
 * Copyright (C) 2013-2014 the original author or authors.
 */
package com.foreveross.bsl.comments.application.vo;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * xxx
 * 
 * @author Wangyi
 * @version v1.0
 * 
 * @date 2013-7-19
 * 
 */
public class NoticeVo {
	private String id;
	private String title;
	private String content;
	private String appId;
	private String appName;
	private String ownerId;
	private String[] roles;
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date createTime;
	private String pushRequestId;
	/**
	 * 终端处理推送消息相关,是否在模块图标上显示消息条数
	 */
	private boolean moduleBadge;
	/**
	 * 终端处理推送消息相关,是否点击模块消息时显示模块业务信息
	 */
	private boolean busiDetail;

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param title
	 *            the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return the content
	 */
	public String getContent() {
		return content;
	}

	/**
	 * @param content
	 *            the content to set
	 */
	public void setContent(String content) {
		this.content = content;
	}

	/**
	 * @return the appId
	 */
	public String getAppId() {
		return appId;
	}

	/**
	 * @param appId
	 *            the appId to set
	 */
	public void setAppId(String appId) {
		this.appId = appId;
	}

	/**
	 * @return the createTime
	 */
	public Date getCreateTime() {
		return createTime;
	}

	/**
	 * @param createTime the createTime to set
	 */
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	/**
	 * @return the appName
	 */
	public String getAppName() {
		return appName;
	}

	/**
	 * @param appName the appName to set
	 */
	public void setAppName(String appName) {
		this.appName = appName;
	}

	/**
	 * @return the ownerId
	 */
	public String getOwnerId() {
		return ownerId;
	}

	/**
	 * @param ownerId the ownerId to set
	 */
	public void setOwnerId(String ownerId) {
		this.ownerId = ownerId;
	}

	/**
	 * @return the roles
	 */
	public String[] getRoles() {
		return roles;
	}

	/**
	 * @param roles the roles to set
	 */
	public void setRoles(String[] roles) {
		this.roles = roles;
	}
	
	@JsonIgnore
	public String getCommaRoles(){
		if(this.hasRoles()){
			StringBuilder sb=new StringBuilder(this.roles[0]);
			for(int i=1; i<this.roles.length; i++){
				sb.append(',').append(this.roles[i]);
			}
			return sb.toString();
		}
		return null;
	}

	@JsonIgnore
	public boolean hasRoles(){
		return roles!=null && roles.length>0;
	}

	/**
	 * @return the pushRequestId
	 */
	public String getPushRequestId() {
		return pushRequestId;
	}

	/**
	 * @param pushRequestId the pushRequestId to set
	 */
	public void setPushRequestId(String pushRequestId) {
		this.pushRequestId = pushRequestId;
	}

	/**
	 * @return the moduleBadge
	 */
	public boolean isModuleBadge() {
		return moduleBadge;
	}

	/**
	 * @param moduleBadge the moduleBadge to set
	 */
	public void setModuleBadge(boolean moduleBadge) {
		this.moduleBadge = moduleBadge;
	}

	/**
	 * @return the busiDetail
	 */
	public boolean isBusiDetail() {
		return busiDetail;
	}

	/**
	 * @param busiDetail the busiDetail to set
	 */
	public void setBusiDetail(boolean busiDetail) {
		this.busiDetail = busiDetail;
	}
}
